package Final;


import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class ExecuteBatch {
//201521123082
	public static void main(String[] args) {
		 Connection conn=null;
		 Statement stat=null;
		 ResultSet rs=null;
		 String sql = "insert into students(stuno,name,age,birthdate) values('2015082', 'moyi',20,'1997-05-28');";
		 long begin=System.currentTimeMillis();
		 try {
			 	conn = JDBCUtil.getConnection();

			 	for(int i=0;i<1000;i++)
			 	{
			 		stat = conn.createStatement();
			 		stat.addBatch(sql);  
			 		stat.executeBatch();
			 	}
			 	
		 } catch (SQLException sqle) {
				sqle.printStackTrace();
			}catch(Exception e){
				e.printStackTrace();
			}finally{
			 JDBCUtil.realeaseAll(null,stat, conn);
		 }
		 long end=System.currentTimeMillis();
		 System.out.println(end-begin+"ms");
	}
}

